import React, { useCallback, useMemo, useRef, useState } from "react";
import { DevTree, LayoutB, DevPopup, SortableDevTree, CpasIcon } from '~/public/cpas-ui';
import { handleStr, nanoid10 } from "@/utils";
import { useModel } from "umi";
import { getSubjectType } from "@/pages/ReportFinancial/service";
import {
  Addsubject, AssistAdd, AssistDel, AssistEdit, AssistgetType, AutoAddChildrenForFZZ,
  Editsubject, getNewKMBH, IsCanAddFZZ, SubjectDel, SubjectIsHasFZZ
} from "@/pages/components/ProjectTreeTabsComponent/service";
import notify from "devextreme/ui/notify";
import PhaseDeleteDialog from "@/pages/components/ProjectTreeTabsComponent/PhaseDeleteDialog";
import AuxiliaryPopup from "@/pages/components/ProjectTreeTabsComponent/components/AuxiliaryPopup";
import SubjectPopupData from "@/pages/components/ProjectTreeTabsComponent/components/SubjectsPopup";
import { getAccountInfo, getSubjectParentList } from "./service";

// import AntTabs, { HocVerticalLeftStyleTab } from "~/public/cpas-ui/components-ui/ant-components/AntTab";

// import FirstLevelSubjectPopup from "../../../../../../../../ReportFinancial/components/TableComponents/components/FirstLevelSubjectPopup";

const DevTreeRight = (props: any) => {
  const { data, DataId, refreshSubject, onItemClick, treeDragEnd, gridData } = props;
  console.log(DataId, 'DataId---');


  const { initialState } = useModel('@@initialState');
  const { dbname } = initialState?.curPart as API.CurPart;
  const { username } = initialState?.curUser as API.CurUser;
  const FirstLevelSubjectPopupRef = useRef<any>();//快速新增一级科目
  const PhaseDeleteRef = useRef<any>();//删除模板
  const SubjectPopupRef = useRef<any>();//新增科目模板
  const AuxiliaryPopupRef = useRef<any>();
  const TreeAuxiliaryRef = useRef<any>();
  const ParentLevel = useRef<any>();
  // const treeRef = useRef<any>();

  const devTreeRef = useRef<any>();
  const typeRef = useRef<any>();
  const typeErrorRef = useRef<any>();

  const curNodeRef = useRef<any>();
  const [AddFZZKMMC, setIsCanAddFZZKMMC] = useState<string>('');
  const [itemData, setItemData] = useState<any>({});
  const [curRowKMMC, setCurRowKMMC] = useState<string>("");
  // const Divstyle: React.CSSProperties = {
  //   display: 'flex',
  //   alignItems: 'center',
  //   justifyContent: 'center',
  //   width: "10%",
  //   height: "31px",
  //   marginRight: "5px"
  // };


  // const saveAddsubject = async (tempObj: any) => {
  //   const res = await Addsubject(tempObj);
  //   if (res.ok) {
  //     notify("增加科目成功", 'success', 2000);
  //     refreshSubject(true);
  //   }
  // }
  const saveAddsubject = async (tempObj: any, isAddMoreYear: boolean) => {
    if (!isAddMoreYear) {
      const res = await Addsubject(tempObj);
      if (res.ok) {
        notify("增加科目成功", 'success', 2000);
        refreshSubject(true);
      }
      return;
    }
    const resYear: any = await getAccountInfo({ dbname });
    if (resYear.success) {
      const yearData = resYear.data.map((item: any) => item.Data_ID);
      const tempA: any = [];
      for (let index = 0; index < yearData.length; index++) {
        const element = yearData[index];
        if (element) {
          const res = await Addsubject({ ...tempObj, Data_ID: element });
          if (res.ok && res.data > 0) {
            tempA.push(Promise.resolve('ok'));
          } else {
            tempA.push(Promise.resolve(`${element}年:${res.data}`));
          }
        }
      }
      Promise.allSettled(tempA).then(results => {
        console.log(tempA, results, '@@@');
        refreshSubject(true);
        const falseData = results.filter((item1: any) => item1.value !== 'ok').map((item: any) => item.value);
        if (falseData.length) {
          // notify(`增加科目失败，失败原因为【${falseData.join(';')};】`, falseData.length === yearData.length ? 'error' : 'warning', 2000);
          notify(`增加科目失败，失败原因为【${falseData.join(';')};】`, 'warning', 4000);
        } else {
          notify("增加科目成功", 'success', 2000);
        }
      }).catch(error => {
        // 处理错误
        console.error("An error occurred:", error);
      });

    } else {
      notify(`获取年度失败！`, 'error', 2000);
    }

  }


  // 判断 是否为 66为辅助类型 99辅助账 辅助账类型根据 辅助账类型判断数据的分类 进行分组处理和过滤数据的表格的数据渲染
  // 判断 是否为 66为辅助类型 99辅助账
  const subjectMethod = async (e: any, r: any) => {
    const itemNames = r.selectedYears || '';
    let tempObj = {};

    if (e) {
      //r ? 有返回参数 说明他有上级科目 : 说明它是增加一级科目
      tempObj = {
        dbname,
        Data_ID: DataId,
        KMBH: r.KMBH ? r.KMBH : r.KMBHAdd + '~|',
        KMMC: r.KMMC ? r.KMMC + '-' + r.SubjectNumber : r.SubjectNumber,
        editUser: username,
        PKMBH: r.PKMBH,
        YSKMBH: `${r.KMBHAdd}`,
        YSKMMC: r.SubjectNumber,
        KMFX: r.SelectName,
        KMLX: r.SelectType,
        JC: r.Satatejc ? Number(r.Satatejc) + 1 : 1,
        itemNames: itemNames
      }
      console.log(tempObj, '@@@');
      saveAddsubject(tempObj, r.checkBoxState);
    }
  }

  const saveAssistAdd = async (dataObj: any, isAddMoreYear: any) => {
    if (!isAddMoreYear) {
      const data = await AssistAdd(dataObj);
      if (data.ok) {
        notify("增加辅助账成功", 'success', 2000);
        refreshSubject(true);
      }
      else {
        notify('该科目下已存在相同名称的辅助核算项目，无法重复新增！', 'error', 4000)
      }
      return;
    }
    const resYear: any = await getAccountInfo({ dbname });
    if (resYear.success) {
      const yearData = resYear.data.map((item: any) => item.Data_ID);
      const tempA: any = [];
      for (let index = 0; index < yearData.length; index++) {
        const element = yearData[index];
        if (element) {
          const res = await AssistAdd({ ...dataObj, Data_ID: element });
          if (res.ok && res.data > 0) {
            tempA.push(Promise.resolve('ok'));
          } else {
            tempA.push(Promise.resolve(`${element}年:${res.data}`));
          }
        }
      }
      Promise.allSettled(tempA).then(results => {
        console.log(tempA, results, '@@@');
        refreshSubject(true);
        const falseData = results.filter((item1: any) => item1.value !== 'ok').map((item: any) => item.value);
        if (falseData.length) {
          // notify(`增加科目失败，失败原因为【${falseData.join(';')};】`, falseData.length === yearData.length ? 'error' : 'warning', 2000);
          notify(`增加科目失败，失败原因为【${falseData.join(';')};】`, 'warning', 2000);
        } else {
          notify("增加辅助账成功", 'success', 2000);
        }
      }).catch(error => {
        // 处理错误
        console.error("An error occurred:", error);
      });

    } else {
      notify(`获取年度失败！`, 'error', 2000);
    }
  }




  const openAuxiliaryPopup = (tmepArgs: any, tmepBH: any, tempRowData: any) => {
    let tempObj: any = {
      dbname,
      Data_ID: DataId,
      editUser: username,
    };
    AuxiliaryPopupRef.current.show({
      args: tmepArgs,
      okCallback: (v: any) => {
        tempObj = {
          ...tempObj,
          KMBH: v.KMBH ? v.KMBH : tempRowData.KMBH,
          KMMC: v.KMMC ? v.KMMC : tempRowData.KMMC,
          HSXMLXBH: v.SelectHSXMLXBH,
          YSKMBH: `${v.YSKMBH}` ? `${v.YSKMBH}` : `${tmepBH}`,
          HSXMLXMC: v.selectValue,
          HSXMBH: v.SelectHSXMLXBH + '-' + v.projectValueMds + '~|',
          HSXMMC: v.projectValues,
          YSHSXMMC: v.projectValues,
          YSHSXMBH: v.SelectHSXMLXBH + '-' + v.projectValueMds
        };
        saveAssistAdd(tempObj, v.checkBoxState);
      },
      cancelCallback: () => {
      }
    });
  }

  const menuAddsubjectFunc = async (rowData: any) => {
    const MatchKMMC = rowData.KMMC.match(/(\S*)-/);
    setCurRowKMMC(rowData.KMMC);
    const { data: tabsArray } = await getSubjectType({
      dbname,
      Data_ID: DataId,
    });

    if (rowData.JC === 1) {
      SubjectPopupRef.current.show({
        args: {
          title: '新增科目',
          KMBH: "",
          data: tabsArray,
          ParentLevel: '',
          ParentLevelKmbh: "",
          PKMBH: '',
          resolvess: rowData.KMMC,
          datatKMFX: rowData.KMFX,
          dataKMLX: rowData.KMLX,
          isEdit: false,
        },
        okCallback: (r: any) => {
          console.log(r, '@@@ 新增科目');
          if (r) {
            const itemNames = r.selectedYears || '';
            let tempObj: any = {
              dbname,
              Data_ID: DataId,
              editUser: username,
              YSKMBH: `${r.KMBHAdd}`,
              YSKMMC: r.SubjectNumber,
              KMFX: r.SelectName,
              KMLX: r.SelectType,
              itemNames: itemNames,
              KMBH: r.KMBH ? r.KMBH : r.KMBHAdd + '~|',
            };
            if (r.Satatejc) {
              tempObj = {
                ...tempObj,
                KMMC: r.KMMC + '-' + r.SubjectNumber,
                PKMBH: r.PKMBH,
                JC: Number(r.Satatejc) + 1,
              }
            } else {
              tempObj = {
                ...tempObj,
                KMMC: r.SubjectNumber,
                PKMBH: "",
                JC: rowData.JC,
              }
            }
            console.log(r, tempObj, '@@@ 这是新增科目tempObj');
            saveAddsubject(tempObj, r.checkBoxState);
          }
        },
        cancelCallback: () => {
        }
      });
      return;
    }
    if (rowData.ZWType === 1) {
      // const eKMMC = curNodeRef.current.KMMC.match(/(\S*)-/);
      // 判断 是否为 66为辅助类型 99辅助账
      if (rowData.level === 66) {
        // 在辅助类型上 增加 科目参数传递有误
        typeRef.current.show({
          title: "提示",
          okCallback: () => {
            typeErrorRef.current.show({
              title: "提示",
              okCallback: () => {
                // 后期在业务组件里面做判断
                SubjectPopupRef.current.show({
                  args: {
                    title: '新增科目',
                    KMBH: "",
                    data: tabsArray,
                    ParentLevel: '',
                    ParentLevelKmbh: "",
                    PKMBH: '',
                    resolvess: '',
                    datatKMFX: rowData.KMFX,
                    dataKMLX: rowData.KMLX,
                    isEdit: false,
                  },
                  okCallback: (r: any) => {
                    subjectMethod(MatchKMMC, r);

                  },
                  cancelCallback: () => {
                  }
                });
              }
            });
          }
        });
        return;
      }
      if (rowData.level === 99) {
        // 在辅助账数据上 增加 科目参数传递有误
        SubjectPopupRef.current.show({
          args: {
            title: '新增科目',
            KMBH: "",
            data: tabsArray,
            ParentLevel: '',
            ParentLevelKmbh: "",
            PKMBH: '',
            resolvess: '',
            datatKMFX: rowData.KMFX,
            dataKMLX: rowData.KMLX,
            isEdit: false,
          },
          okCallback: (r: any) => {
            console.log(r, '--rrr-----rrrr辅助帐增加科目');
            subjectMethod(MatchKMMC, r);

          },
          cancelCallback: () => {
          }
        });
      }
      return;
    }
    console.log(rowData, 'data----');

    let parentLevelName = '';
    let resolvess = '';
    if (rowData.PKMBH) {
      const res = await getSubjectParentList({ dbname, Data_ID: DataId, PKMBH: rowData.PKMBH });
      if (res.success) {
        const { data } = res;
        parentLevelName = data.displayName;
        resolvess = data.KMMC;
      }
    }
    const RNewKMBH = await getNewKMBH({
      dbname,
      Data_ID: DataId,
      KMBH: rowData.PID
    });
    SubjectPopupRef.current.show({
      args: {
        title: '新增科目',
        KMBH: RNewKMBH.data[0].KMBH,
        data: tabsArray,
        ParentLevel: parentLevelName,
        ParentLevelKmbh: RNewKMBH.data[0].YSKMBH,
        PKMBH: rowData.PKMBH,
        resolvess,
        datatKMFX: rowData.KMFX,
        dataKMLX: rowData.KMLX,
        isEdit: false,
      },
      okCallback: (r: any) => {
        console.log(r, '------');
        // 修改 变动
        const itemNames = r.selectedYears || '';
        let dataObj = {};
        // 如果 他的上级科目被删除了 执行下方方法
        if (r.PKMBHState) {
          dataObj = {
            dbname,
            Data_ID: DataId,
            KMBH: r.KMBH ? r.KMBH : r.KMBHAdd + '~|',
            KMMC: r.SubjectNumber,
            editUser: username,
            PKMBH: "",
            YSKMBH: `${r.KMBHAdd}`,
            YSKMMC: r.SubjectNumber,
            KMFX: r.SelectName,
            KMLX: r.SelectType,
            JC: 1,
            itemNames: itemNames,
          }
        } else {
          dataObj = {
            dbname,
            Data_ID: DataId,
            KMBH: r.KMBH ? r.KMBH : RNewKMBH.data[0].KMBH,
            KMMC: `${r.KMMC ? r.KMMC : resolvess}-${r.SubjectNumber}`,
            editUser: username,
            PKMBH: r.PKMBH,
            YSKMBH: `${r.KMBHAdd}`,
            YSKMMC: r.SubjectNumber,
            KMFX: r.SelectName,
            KMLX: r.SelectType,
            JC: r.Satatejc ? Number(r.Satatejc) + 1 : rowData.JC,
            itemNames: itemNames,
          }
        }
        console.log(r, dataObj, '@@@');
        // debugger;
        saveAddsubject(dataObj, r.checkBoxState);

      },
      cancelCallback: () => {
      }
    });
    return;
  }
  // 判断是否可以增加辅助账
  const IsCanAddFZZStates = async (vData: any, isBoolean: boolean, vRowData: any) => {
    if (isBoolean) {
      const YSKMBH = handleStr(vRowData.KMBH);
      const r = await AssistgetType({
        dbname,
        Data_ID: DataId,
        KMBH: vRowData.KMBH
      });
      openAuxiliaryPopup({
        title: '新增辅助账',
        value: YSKMBH + '-' + vRowData.KMMC,
        auxiliaryState: true,
        items: r,
        edit: false,
        fzzData: vRowData
      }, YSKMBH, vRowData);
      return;
    }
    const value = await AutoAddChildrenForFZZ({
      dbname,
      Data_ID: DataId,
      KMBH: vRowData.KMBH,
      editUser: username
    });
    const r = await AssistgetType({
      dbname,
      Data_ID: DataId,
      KMBH: value[0].KMBH,
    });
    const PKMBH = handleStr(value[0].KMBH);
    console.log(value, 'value---');
    if (vData.code === 1) {
      openAuxiliaryPopup({
        title: '新增辅助账',
        value: PKMBH + '-' + value[0].KMMC,
        auxiliaryState: true,
        items: r,
        edit: false,
        fzzData: vRowData
      }, PKMBH, vRowData);
      return;
    } else if (vData.code === 2) {
      setIsCanAddFZZKMMC(vData.message);
      TreeAuxiliaryRef.current.show({
        title: "提示",
        okCallback: () => {
          openAuxiliaryPopup({
            title: '新增辅助账',
            value: PKMBH + '-' + value[0].KMMC,
            auxiliaryState: true,
            items: r,
            edit: false,
            fzzData: value[0]
          }, PKMBH, vRowData);
        }
      });
      return;
    }
  }


  const menuEditsubjectFunc = async (rowData: any) => {
    const YSKMBH = handleStr(rowData.KMBH);
    const YSHSXMBH = handleStr(rowData.code);
    setCurRowKMMC(rowData.KMMC);
    const { data: tabsArray } = await getSubjectType({
      dbname,
      Data_ID: DataId,
    });
    if (rowData.ZWType === 1) {
      const r = await AssistgetType({
        dbname,
        Data_ID: DataId,
        KMBH: rowData.KMBH
      });
      // 判断 是否为 66为辅助类型 99辅助账
      if (rowData.level === 66) {
        return openAuxiliaryPopup({
          title: '新增辅助账',
          value: YSKMBH + '-' + rowData.KMMC,
          auxiliaryState: true,
          items: r,
          edit: false,
          fzzData: rowData
        }, YSKMBH, rowData);
      }
      console.log(rowData, 'curNodeRef.current.KMBH---');
      if (rowData.isNewAdd) {
        return AuxiliaryPopupRef.current.show({
          args: {
            title: '编辑辅助账',
            value: YSKMBH + '-' + rowData.KMMC,
            auxiliaryState: true,
            items: r,
            edit: true,
            HSXMMC: rowData.HSXMMC,
            fzzData: rowData
          },
          okCallback: async (v: any) => {
            const data = await AssistEdit({
              dbname,
              Data_ID: DataId,
              KMBH: rowData.KMBH,
              KMMC: rowData.KMMC,
              editUser: username,
              HSXMLXBH: v.SelectHSXMLXBH,
              YSKMBH: `${YSKMBH}`,
              HSXMLXMC: v.selectValue,
              HSXMBH: rowData.code + '~|',
              HSXMMC: v.projectValue,
              YSHSXMMC: v.projectValue,
              YSHSXMBH: YSHSXMBH
            })
            if (data) {
              notify("修改辅助账成功", 'success', 2000);
              refreshSubject(true);
            }
          },
          cancelCallback: () => {
          }
        });
      }
      notify(`辅助账【${rowData.HSXMMC}】为企业原始辅助账,不可编辑`, 'warning', 2000)
      return;

    } else {
      console.log(rowData, "111111");
      // 编辑 科目
      if (rowData.isNewAdd) {

        let parentLevelName = '';
        let resolvess = '';
        if (rowData.PKMBH) {
          const res = await getSubjectParentList({ dbname, Data_ID: DataId, PKMBH: rowData.PKMBH });
          if (res.success) {
            const { data } = res;
            parentLevelName = data.displayName;
            resolvess = data.KMMC;
          }
        }
        console.log(rowData, '@@@ 编辑 科目');

        SubjectPopupRef.current.show({
          args: {
            title: '编辑',
            KMBH: rowData.KMBH,
            data: tabsArray,
            ParentLevel: rowData.JC === 1 ? "" : parentLevelName,
            ParentLevelKmbh: Number(rowData?.YSKMBH || 0),
            PKMBH: rowData.PKMBH,
            KMMC: rowData.YSKMMC,
            datatKMFX: rowData.KMFX,
            dataKMLX: rowData.KMLX,
            itemNames: rowData.itemNames,
            resolvess,
            isEdit: true,
          },
          okCallback: async (v: any) => {
            console.log(resolvess, 'resolvess-----');
            console.log("确定回调函数");
            const itemNames = v.selectedYears || rowData.itemNames;
            const tempKMMC = `${resolvess && resolvess + '-'}${v.SubjectNumber}`;
            const r = await Editsubject({
              dbname,
              Data_ID: DataId,
              KMBH: rowData.KMBH,
              KMMC: tempKMMC,
              editUser: username,
              YSKMMC: v.SubjectNumber,
              KMFX: v.SelectName,
              KMLX: v.SelectType,
              itemNames: itemNames,
            })
            if (r.ok) {
              notify("编辑科目成功", 'success', 2000);
              refreshSubject(true);
            }
          },
          cancelCallback: () => {
          }
        });
      } else {
        notify(`科目【${rowData.KMMC}】为企业原始科目,不可编辑`, 'warning', 2000)
      }
    }
  }
  // const firstLevelSubjectFunc = () => {

  //   FirstLevelSubjectPopupRef.current.show({
  //     args: {
  //       title: '快速新增一级科目',
  //       selectYear: DataId
  //     },
  //     okCallback: () => {
  //       refreshSubject(true);
  //     }
  //   })
  // }
  // 树结构 
  const menuItems = [
    // {
    //   text: "快速新增一级科目",
    //   onItemClick: () => {
    //     firstLevelSubjectFunc();
    //   },
    // },
    {
      text: "增加科目",
      onItemClick: () => {
        menuAddsubjectFunc(curNodeRef.current);
      },
    },
    {
      text: "增加辅助账",
      onItemClick: async () => {
        const rowData = curNodeRef.current;
        const IsHasFZZ = await SubjectIsHasFZZ({
          dbname,
          Data_ID: DataId,
          KMBH: rowData.KMBH
        });
        const IsCanAddFZZState = await IsCanAddFZZ({
          dbname,
          Data_ID: DataId,
          KMBH: rowData.KMBH
        });
        console.log(IsHasFZZ, 'IsHasFZZ---');
        // 判断 是否存在辅助账
        if (IsHasFZZ[0].isExists) {
          // 存在辅助账 判断是否可以增加辅助账
          IsCanAddFZZStates(IsCanAddFZZState[0], true, rowData);
        } else {
          if (IsCanAddFZZState[0].code === 0) {
            console.log("触发---");
            notify(`${IsCanAddFZZState[0].message}`, 'warning', 2000);
            return;
          }
          IsCanAddFZZStates(IsCanAddFZZState[0], false, rowData);
        }
      },
    },
    {
      text: "编辑",
      onItemClick: () => {
        menuEditsubjectFunc(curNodeRef.current);
      },
    },
    {
      text: "删除",
      onItemClick: (e: any) => {
        PhaseDeleteRef.current.show({
          args: {
            title: '询问',
            codes: true,
            Name: curNodeRef.current.displayName,
            HSXMLXBH: curNodeRef.current.HSXMLXBH
          },
          okCallback: async () => {
            if (curNodeRef.current.HSXMLXBH) {
              // 删除 辅助账
              const r = await AssistDel({
                dbname,
                Data_ID: DataId,
                KMBH: curNodeRef.current.KMBH,
                editUser: username,
                HSXMLXBH: curNodeRef.current.HSXMLXBH,
                HSXMBH: curNodeRef.current.code + '~|'
              })
              if (!r.ok) {
                notify(`${r.data}`, 'warning', 2000)
              } else {
                notify('删除辅助账成功', 'success', 2000); refreshSubject(true)
              }
            } else {
              // 删除 科目表
              const r = await SubjectDel({
                dbname,
                Data_ID: DataId,
                editUser: username,
                KMBH: curNodeRef.current.KMBH
              })
              if (r.ok) {
                notify('删除科目成功', 'success', 2000); refreshSubject(true)
              } else {
                notify(`${r.data}`, 'warning', 2000)
              }
            }
          }
        });
      },
    },
  ];


  const treeViewItemContextMenu = useCallback((item: any) => {

    (devTreeRef.current as any)?.treeRef.current.instance?.selectItem(item.itemData.ID);
    // const e = item.itemData.KMMC.match(/(\S*)-/);
    // if (e !== null) {
    //   const v = handleStr(item.itemData.PID)
    //   ParentLevel.current = v + '-' + e[1]
    // }
    curNodeRef.current = item.itemData;
  }, [])

  const itemDblClick = () => {
    onItemClick(itemData)
  }
  // ,useCallback( [itemData])



  return (
    <div style={{ width: "100%", height: "100%" }}>
      <SortableDevTree
        key={`treeGrid_${nanoid10()}`}
        treeDragEnd={(fromData: any, toData: any) => {
          console.log(fromData, 'fromData---');
          console.log(toData, 'toData----');
          treeDragEnd(fromData.itemData, toData);
        }}
        gridData={gridData}
        height="100%"
        group={"treeGrid"}
        id={"leftTree"}
        ref={devTreeRef}
        selectionMode='single'
        // selectByClick={true}
        items={data}
        dataStructure="plain"
        searchMode="contains"
        displayExpr='displayName'
        parentIdExpr='PID'
        keyExpr='ID'
        rootValue='0'
        onItemDblClick={itemDblClick}
        ContextMenu={menuItems}
        onItemClick={(e: any) => {
          setItemData(e.itemData);
        }}
        // onItemClick={selectItem}
        onItemContextMenu={treeViewItemContextMenu} treeDomId={"SetClassiFicationDom"}
      />
      {/* {useMemo(() => {
        return }, [gridData, data])} */}



      <PhaseDeleteDialog ref={PhaseDeleteRef} />
      <SubjectPopupData ref={SubjectPopupRef} AccountDataID={DataId} />
      <AuxiliaryPopup ref={AuxiliaryPopupRef} AccountDataID={DataId} />
      {/* <FirstLevelSubjectPopup ref={FirstLevelSubjectPopupRef} AccountDataID={DataId} /> */}

      <DevPopup.Default ref={TreeAuxiliaryRef}>
        {() => {
          // 
          return <span>{`${AddFZZKMMC}`}</span>;
        }}
      </DevPopup.Default>
      <DevPopup.Default ref={typeRef}>
        {() => {
          // 
          return <span>{`【${curRowKMMC}】为末级科目，是否继续为其增加下级科目？`}</span>;
        }}
      </DevPopup.Default>
      <DevPopup.Default ref={typeErrorRef}>
        {() => {
          return <>
            <span>{`【${curRowKMMC}】`}</span>
            <span style={{ color: "red" }} >为末级科目，已被设置辅助账，无法增加下级科目!</span>
          </>
        }}
      </DevPopup.Default>
    </div>
  )
}

export default DevTreeRight;

